package com.example.siyun.controller.permissionscontroller;

import com.example.siyun.pojo.EnumPojo;
import com.example.siyun.pojo.PeoperateLog;
import com.example.siyun.service.permissionsservice.PeoperateLogService;
import com.example.siyun.util.PageResult;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @Auther: 全
 * @Date: 2022/9/26 09:33
 * @Description:权限管理模块操作日志
 */
@Slf4j
@RestController
public class PeoperateLogController {
    @Autowired
    private PeoperateLogService peoperateLogService;
    /**
     * 获取操作日志的信息
     * @return 返回操作日志的信息
     */
    @RequestMapping("/advanced/getpeoperatelog")
    public PageResult getPeoperateLog(int page, int limit, PeoperateLog peoperatelog) {
        log.info("获取操作日志的信息");
        PageHelper.startPage(page, limit);
        List<PeoperateLog> list = peoperateLogService.getPeoperateLog(peoperatelog, EnumPojo.VALUE_DEL_0);
        PageInfo<PeoperateLog> pageInfo = new PageInfo<>(list);
        PageResult pageResult=new PageResult();
        pageResult.setState(0);
        pageResult.setMessage("成功");
        pageResult.setTotal(pageInfo.getTotal());
        pageResult.setData(pageInfo.getList());
        log.info("获取操作日志的信息成功");
        return pageResult;
    }
}
